package com.xinhua.control;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.xinhua.entity.Courses;
import com.xinhua.entity.Major;
import com.xinhua.entity.Period;
import com.xinhua.entity.Student;
import com.xinhua.entity.SurveyContent;
import com.xinhua.entity.SurveyDetail;
import com.xinhua.entity.SurveyItem;
import com.xinhua.entity.Teacher;
import com.xinhua.service.CoursesService;
import com.xinhua.service.MajorService;
import com.xinhua.service.PeriodService;
import com.xinhua.service.StudentService;
import com.xinhua.service.SurveyContentService;
import com.xinhua.service.SurveyDetailService;
import com.xinhua.service.SurveyItemService;
import com.xinhua.service.TeacherService;

@RestController
public class InsertManager {
	private List<SurveyItem> sitem;
	private List<Major> major;
	private List<Courses> course;
	private List<Teacher> teach;
	private List<SurveyDetail> sdetail;
	private List<Student> student;
	private List<Period> periods;
	private List<SurveyContent> surconts;

	@Autowired
	private SurveyItemService sis;
	@Autowired
	private SurveyContentService scs;
	@Autowired
	private MajorService ms;
	@Autowired
	private CoursesService cs;
	@Autowired
	private TeacherService ts;
	@Autowired
	private SurveyDetailService sdc;
	@Autowired
	private StudentService ss;
	@Autowired
	private PeriodService ps;
	
	@RequestMapping("/SetInsertHtml")
    public void setInsertHtml(HttpServletRequest req,@RequestParam("insertid")String insertid){
    	HttpSession session=req.getSession(true);
    	session.setAttribute("insertid", insertid);
    }
    
    @RequestMapping("/GetInsertHtml")
    public String getInsertHtml(HttpServletRequest req){
		HttpSession session=req.getSession();
		String insertid=(String) session.getAttribute("insertid");
		String insertText=null;
		switch (insertid) {
		case "0":
			insertText=insertid;
			break;
		case "1":
			insertText=insertid;
			break;
		case "2":
			insertText=insertid;
			break;
		case "3":
			insertText=insertid;
			break;
		case "4":
			insertText=insertid;
			break;
		case "5":
			insertText=insertid;
			break;
		default:
			break;
		}
    	return insertText;
    }
}
